<template>
	<view class="approve-modal" v-if="visible">
		<view class="cu-modal" :class="[visible==true?'show':'']">
			<view class="cu-dialog">
				<view class="cu-bar bg-white justify-end">
					<view class="content" style="width: calc(100% - 100px);">是否确认采购信息无误？</view>
					<view class="action" @tap="hideModal">
						<text class="cuIcon-close text-red"></text>
					</view>
				</view>
				<!-- <view class="padding-xl" > -->
				<!-- </view> -->
				<view class="cu-bar bg-white justify-end">
					<view class="action">
						<button class="cu-btn line-green text-gray" @tap="hideModal">取消</button>
						<button class="cu-btn bg-blue margin-left" @tap="submit">确定</button>
	
					</view>
				</view>
			</view>
		</view>
	
	</view>
</template>

<script>
	import {
		submitOtherRenson
	} from '../../../api/service.js'
	export default {
		data() {
			return {
				visible: false,
				remark: '',
				commentMsg: '',
				entityId: '',
				approve: 0,
				processId: '',
                id:''
			}
		},
		methods: {
			hideModal() {
				this.remark = '';
				this.commentMsg = '';
				this.entityId = '';
				this.approve = 0;
				this.processId = '';
				this.visible = false;
			},
			show(record) {
				console.log(record)
				this.visible = true;
				this.id= record.id;
				this.processId = record.processId;

			},
			submit() {
				var _this=this;
				uni.showLoading({
				    title: '数据正在处理中....'
				});
				submitOtherRenson({
					processId: this.processId,
					cgId: this.id
				}).then(res=>{
					 uni.hideLoading();
					if(res.success){
						uni.showToast({
							title:'操作成功！',
							duration:1500,
							success:function() {
							
								setTimeout(function(){
									uni.$emit('updateProInfo',{msg:'--'});
									uni.$emit('updateMount',{})
									uni.navigateBack({
										delta:1
									})
								},1500)
								
								_this.hideModal();
							}
						})
					}else{
					uni.showToast({
						title:'操作失败！',
						duration:1500
					})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.statt-border {
		border-bottom: 2rpx solid #F5F5F5;
		border-top: 2rpx solid #f5f5f5;
		text-align: left;
		line-height: 32rpx;
	}
</style>
